System and method for analyzing sequential data access efficiency

ABSTRACT

A system and method determines sequential access efficiency for a database table. A number of data block changes that occur during a sequential access of a plurality of rows in a database table are determined. The sequential access efficiency is calculated based on the determined number of data block changes.

TECHNICAL FIELD

The invention relates to the field of relational database systems andproducts. More particularly, the invention relates to determiningsequential access efficiency for relational database tables.

BACKGROUND

Relational database management systems provide data row storage optionsthat allow data row storage to be varied from a selected native keysequence. Various data storage options may be utilized, for example,“clustered” (which attempts to place the data rows in native keysequence but allows some deviation if space becomes a concern),“sequential” (which places new data rows at the end of the existingspace and when space is exhausted, wraps back to the front of a tableand begins adding data rows there), “random” (which places data rowswherever there is available space). The “random” option is most commonlyused because it consumes the least amount of resources.

For most indexed access of data rows, the actual data row order in thetable has no effect on the performance of the database or the accessingapplication. However, various applications require access to largesegments of data rows using a sequential (read next) process. In thesecases, the native key sequence may be selected to access the data rows.

Over a period of time with additions and deletions of data rows from thedatabase table, the data row sequence becomes disorganized. When thisdisorganization occurs, the application accessing the data rowsaccording to native key sequence slows because the database managementsystem is required to perform substantially more physical IOs toretrieve the data rows in the native key sequence.

In order to re-order the data rows according to the native key sequence,database reorganization processes may be regularly scheduled. However,database reorganizations may be resource-intensive and in some casesunnecessary. In these cases, database resources may be wasted whenreorganizing database tables that do not need reorganization. Thus, whatis needed is a low cost (resource-wise) way to determine whether atleast a portion of a sequential-access database will benefit fromreorganization.

These and other drawbacks exist.

SUMMARY

Various systems, computer program products, and methods for determiningsequential access efficiency for a database table are described herein.

According to various implementations of the invention, the method mayinclude a plurality of operations. In some implementations, theoperations may include determining a sequential access of a plurality ofrows of a database table, wherein the plurality of rows are stored usinga plurality of data blocks, and wherein the sequential access occurswhen at least a portion of the database table is accessed. In someimplementations, the operations may include determining a number of datablock changes that occur during the sequential access of the pluralityof rows in the database table, wherein a data block change occurs when acurrent row is stored in a first data block and a next row is stored ina second data block that is different from the first data block suchthat accessing the next row after accessing the current row results inthe data block change. In some implementations, the operations mayinclude determining a sequential access efficiency based on thedetermined number of data block changes.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated into and constitute apart of this specification, illustrate one or more examples ofimplementations of the invention and, together with the description,serve to explain various principles and aspects of the invention.

FIG. 1 illustrates an exemplary database management system, according tovarious aspects of the invention.

FIGS. 2A and 2B illustrate exemplary charts depicting sequential accessefficiency, according to various aspects of the invention.

FIGS. 3A and 3B illustrate exemplary charts depicting bufferedsequential access efficiency, according to various aspects of theinvention.

FIGS. 4, 4A and 5 illustrate exemplary reports generated by a databasemanagement system, according to various aspects of the invention.

FIG. 6 is a flowchart depicting example operations performed by adatabase management system to determine sequential access efficiency fora database table, according to various aspects of the invention.

Reference will now be made in detail to various implementations of theinvention as illustrated in the accompanying drawings. The samereference indicators will be used throughout the drawings and thefollowing description to refer to the same or like items.

DESCRIPTION OF EXEMPLARY IMPLEMENTATIONS

FIG. 1 is an exemplary illustration of a database management system 100,according to an aspect of the invention. Database management system 100may include, among other things, at least a database management server112 that is configured to manage one or more relational databases and/orindexes for the relational databases. Database management server 112 maybe communicatively coupled to one or more data storage access devices(DASD) 120 that may store/maintain one or more database tablesassociated with relational database(s), store/maintain one or moreindexes for the tables in the database(s), and/or other data structures.In some implementations, database management server 112 may becommunicatively coupled to a client device 110 (illustrated in FIG. 1 asa plurality of client devices 110A, . . . , 110N). Database managementserver 112 may be coupled to client device 110 via a network 130.Network 130 may include a Local Area Network, a Wide Area Network, acellular communications network, a Public Switched Telephone Network,and/or other network or combination of networks.

In some implementations, database management server 112 may include aprocessor 114, a memory 116, and/or other components that facilitate thefunctions of database management server 112. In some implementations,processor 114 includes one or more processors configured to performvarious functions of database management server 112. In someimplementations, memory 116 includes one or more tangible (i.e.,non-transitory) computer readable media. Memory 116 may include one ormore instructions that when executed by processor 114 configureprocessor 114 to perform functions of database management server 112. Insome implementations, memory 116 may include one or more instructionsstored on tangible computer readable media that when executed at aremote device, such as client device 110, cause the remote device todisplay at least one report, as described herein.

Database administrators (or other users) may interact with the databasemanagement server 112 via client device 110. In some implementations,client device 110 may include a computing/processing device such as adesktop computer, a laptop computer, a network computer, a wirelessphone, a personal digital assistant, a tablet computing device,workstation, and/or other computing devices that may be utilized tointeract with database management server 112. In some implementations,client device 110 may comprise a user interface (not otherwiseillustrated in FIG. 1) that may enable users to perform variousoperations that may facilitate interaction with database managementserver 112 including, for example, providing requests to retrieveinformation from database tables, create tables, add/delete/updaterows/columns in database tables, create/delete/update/access one or moreindexes associated with the database tables, providing requests fordetermining sequential access efficiency for database tables, providingrequests to generate one or more reports associated with the databasetables, receiving one or more reports associated with the databasetables and displaying the reports, and/or performing other operations.Client device 110 may include a processor (not otherwise illustrated inFIG. 1), circuitry, and/or other hardware operable to executecomputer-readable instructions.

In some implementations, database management server 112 may managevarious operations performed on the relational database(s) stored inDASD 120 and/or one or more database tables in the relationaldatabase(s). For example, database management server 112 may receiverequests (for example, user requests, and/or other requests) to createtable(s), add row(s)/column(s), delete row(s)/column(s), updaterow(s)/column(s), retrieve information from row(s)/column(s), and/orother requests. Database management server 112 may convert the requeststo queries that may be run against the relational database(s) and mayaccordingly create one or more tables in the database(s), add one ormore rows/columns to the tables in database, delete one or morerows/columns from the tables in database, update one or morerows/columns in the tables in database, retrieve requested informationfrom the tables in database, and/or perform other operations. In orderto retrieve requested information from the database, database managementserver 112 may access one or more tables specified by the query (and/orrequest) to determine the information within the tables that matches agiven request criteria specified in the query. Database managementserver 112 may then retrieve the determined information from the tablesand provide it to the user.

In some implementations, database management server 112 may managecreation, deletion, updating, access, and/or other operations associatedwith one or more indexes for the tables in the relational database(s).Database management server 112 may create one or more indexes on one ormore columns of one or more tables. An index entry may refer to oneentry or index value that is in the index and references a given datarow(s) of the database table. An index entry may consist of the value(s)contained in the column(s) being indexed for a given data row, and apointer to the data row. The data row pointer may consist of a datablock number/id within which the data row resides, and the unique rowid. Most access requests within the relational database environment arebased on index access. Index access typically refers to thepre-definition of a specific access path that is created using thevalue(s) of data column(s). Once created, the database can quicklyretrieve data rows that have an index entry (data column value) thatmatches a given request criteria. In some implementations, the indicesmay be stored in a physical area in the DASD 120.

When a data row is added to an indexed table, database management server112 may create an index entry in the index associated with the indexedtable using the data value of the indexed column(s). Similarly, when adata row is deleted from or updated in an indexed table, databasemanagement server 112 may delete the appropriate index entry from theindex or update the appropriate index entry in the index (for example,if the indexed column data value is changed/updated). When a request toretrieve particular information from a table in a database is receivedby database management server 112 (for example, in the form of searchqueries specifying an indexed column), database management server 112may perform an index access to determine one or more index entries thatinclude data values associated with the indexed column and/or thatsatisfy the request. Database management server 112 may identify datarow pointers from the determined index entries that identify or serve aspointers to a specific data row(s) stored in DASD 120. Databasemanagement server 112 may accordingly retrieve one or more data rowsassociated with the data row pointers from DASD 120.

In some implementations, data rows in the tables may be accessed using aspecific index value (“key”). Data rows may be indexed according to oneor more keys, allowing rows to be accessed using one or more indexpaths. The order of keys in a particular index may be referred to as a“key sequence” for that particular index. One of these indices may beselected to correspond to the physical storage order of the data rows inorder to facilitate retrieval from DASD 120. Such an index may bereferred to as a “native key sequence” and may be used when the entirecontent of the database or some portion thereof is accessed in asequential process.

In some implementations, database management server 112 may manage theplacement/storage of a plurality of data rows in a physical data area inthe DASD 120. The physical data area may be separate from where theindices are stored. The plurality of data rows may be stored using aplurality of data blocks (i.e., physical blocks in DASD 120).

In some implementations, database management server 112 may store aninitial set of data rows according to the native key sequence. As datarows are added, deleted, and/or updated by database management server112 and/or data blocks in DASD 120 are reused, the order of data rows inDASD 120 (i.e., data row sequence) may become disorganized. In otherwords, the data rows may no longer be stored according to the native keysequence (i.e., the data rows may no longer be stored in the same orderas the native key sequence). This disorganization may adversely affectapplications running on database management server 112 that requirebatch processing of rows (for example, online billing applications,catalog creating applications, and/or other applications). Theseapplications may require at least a portion of the database table to beaccessed using a sequential (read next) process. In these cases, thenative key sequence may be selected to access the data rows. Whendisorganization of the data row sequence occurs, accessing according tothe native key sequence slows because the database management server 112may be required to perform substantially more accesses to the physicaldata blocks (i.e., physical IOs) to retrieve data rows in the native keysequence from the data blocks.

In some implementations, database management server 112 may receive auser request (or other request) to determine a sequential accessefficiency for a database table. In some implementations, the requestmay include one or more parameters identifying the database table forwhich the sequential access efficiency is to be determined, a native keysequence for the database table, reference group size, and/or otherparameters. In some implementations, the sequential access efficiencymay indicate how close the data row sequence associated with a selectionof rows is to the native key sequence when the selection of rows is readin sequential order.

In some implementations, database management server 112 may determine asequential access of a plurality of rows of a database table, whereinthe sequential access occurs when at least a portion of the databasetable is accessed. In some implementations, database management server112 may determine the sequential access in response to the request. Insome implementations, determining a sequential access may includedetermining a sequential access while the database is online. In someimplementations, determining a sequential access may include determininga sequential access while the database is offline. In someimplementations, determining a sequential access may include accessingthe plurality of rows of the database table sequentially according tothe native key sequence. In some implementations, determining asequential access efficiency may include using a buffer pool managed bya least recently used (LRU) algorithm to determine how the data blocksstored in a plurality of data buffers may improve the sequential accessefficiency.

In some implementations, database management server 112 may determine anumber of data block changes that occur during the sequential access ofthe plurality of rows in the database table. In some implementations,database management server 112 may determine the number of data blockchanges in response to the request. In some implementations, a datablock change may occur when a current data row is stored in a first datablock and a next row is stored in a second data block that is differentfrom the first data block such that accessing the next row afteraccessing the current row results in the data block change. In otherwords, a data block change may refer to the change that occurs when anext data row (accessed according to the native key sequence) is on adata block which is not the same data block that a current data row ison. In some implementations, determining a number of data block changesmay include determining a number of times a data block change occursduring a sequential pass (ascending) of the index values associated withthe native key sequence.

In some implementations, database management server 112 may determine asequential access efficiency based on the determined number of datablock changes. In some implementations, database management server 112may determine the sequential access efficiency in response to therequest. In some implementations, the sequential access efficiency forthe database table may be based on a determined number of data blockchanges and a number of data blocks that contain data. In someimplementations, database management server 112 may determine the numberof data blocks that contain data.

In some implementations, in an ordered database table, the number ofdata block changes when processing/accessing all of the data rows bynative key sequence equals the number of data blocks with at least onedata row in them minus one (minus 1). FIG. 2A illustrates an exemplarychart depicting sequential access efficiency for an ordered databasetable. The data rows are in native key sequence order in the data blocksand there are five data blocks in use (i.e. 5 data blocks that containdata). Rows 1-5 are in data block 1, rows 6-10 are in data block 2, rows11-15 are in data block 3, rows 16-20 are in data block 4, and row 21 isin data block 5. Sequential processing/accessing of these data rows(according to native key sequence) would result in 4 data block changesbecause each data block would be accessed once, and all data rows wouldbe retrieved on that data block before moving to the next data block.For example, as depicted in FIG. 2A, a first block change occurs afterrows 1-5 have been accessed (i.e. change from data block 1 to data block2), a second block change occurs after rows 6-10 have been accessed(i.e. change from data block 2 to data block 3), a third block changeoccurs after rows 11-15 have been accessed (i.e. change from data block3 to data block 4), and a fourth block change occurs after rows 16-20have been accessed (i.e. change from data block 4 to data block 5).

In some implementations, the sequential access efficiency may bedetermined by the following equation:(N _(B)−1)/N _(C)  (1),where N_(B) represents the number of blocks with data and N_(C)represents the number of block changes that occurred or will occurduring sequential access of the data rows.

Thus, the database table of FIG. 2A is determined to have a 100%sequential access efficiency because (5−1)/4=100%.

FIG. 2B illustrates an exemplary chart depicting sequential accessefficiency for an unordered database table (i.e., the data rows are notin native sequence order in the data blocks). Row 1 is in data block 1,row 2 is in data block 2, rows 3-5 are in data block 1, row 6 is in datablock 3, rows 7-10 are in data block 2, row 11 is in data block 1, row12 is in data block 3, rows 13-15 are in data block 4, rows 16-17 are indata block 3, row 18 is in data block 4, row 19 is in data block 5, row20 is in data block 4, and row 21 is in data block 3. Sequentialprocessing/accessing of these data rows would result in 12 data blockchanges which means that on average each data block would be accessedthree times in order to process/access the data rows according to thenative sequence order. For example, as depicted in FIG. 2B, a firstblock change occurs after row 1 has been accessed (i.e. change from datablock 1 to data block 2), a second block change occurs after row 2 hasbeen accessed (i.e. change from data block 2 back to data block 1), athird block change occurs after rows 3-5 have been accessed (i.e. changefrom data block 1 to data block 3), a fourth block change occurs afterrow 6 has been accessed (i.e. change from data block 3 to data block 2),a fifth block change occurs after rows 7-10 have been accessed (i.e.,change from data block 2 to data block 1), a sixth block change occursafter row 11 has been accessed (i.e., change from data block 1 to datablock 3), a seventh block change occurs after row 12 has been accessed(i.e. change from data block 3 to data block 4), an eighth block changeoccurs after rows 13-15 have been accessed (i.e., change from data block4 to data block 3), a ninth block change occurs after rows 16-17 havebeen accessed (i.e., change from data block 3 to data block 4), a tenthblock change occurs after row 18 has been accessed (i.e., change fromdata block 4 to data block 5), an eleventh block change occurs after row19 has been accessed (i.e., change from data block 5 to data block 4),and a twelfth block change occurs after row 20 has been accessed (i.e.,change from data block 4 to data block 3).

Based on equation 1 above, the database table of FIG. 2B is determinedto have a 33% sequential access efficiency because (5−1)/12=33%.

When the sequential access efficiency for the database table is low,sequential access of the database table is likely to take more physicalIOs than when the sequential access efficiency is high for the samedata. This is because each block change may require physical IOs forprocessing. Therefore, more CPU consumption is required to complete thesequential access when the sequential access efficiency is low than whenthe sequential access efficiency is high. Lower physical processingresults in lower CPU consumption and lower elapsed times. Accordingly,when sequential access efficiency is low, a data reorganization may behelpful. On the other hand, when sequential access efficiency is high, adata reorganization may be unnecessary. As would be appreciated, “high”and “low” efficiency may be relative and can be defined according toparticular needs.

In some implementations, database management server 112 may utilizelarge buffer pools (for example, in memory 116) for storing one or moredata blocks as they are accessed/read such that the data blocks may beaccessed multiple times as long as they remain in the buffers.Applications/tasks running on database management server 112 may have anumber of data buffers associated with the tasks. Associating a numberof buffers to a given application/task may improve efficiency and reducethe number of times a data block will need to be retrieved/accessedduring sequential processing. In other words, using buffers may reducephysical IO required for a block change. For example, when data block 1is accessed and placed in a buffer, returning back to data block 1 toretrieve a row may not result in a physical IO in response to the blockchange because data block 1 is still available in memory (buffer), thusreducing the impact or cost of the data block change.

In some implementations, database management server 112 may determine abuffered sequential access efficiency for the database table based on anumber of available buffers. In some implementations, databasemanagement server 112 may determine a buffered sequential access of aplurality of rows of a database table based on a number of buffers usedto buffer the buffered sequential access. In some implementations,determining a buffered sequential access may include accessing theplurality of rows of the database table sequentially according to thenative key sequence and determining utilizing a set number of buffers.In some implementations, database management server 112 may determine anumber of block changes that occur during the buffered sequentialaccess.

For example, if data rows have been sequentially accessed and those rowsresided in four sequentially arranged data blocks (i.e., blocks 1, 2, 3,and 4) and there are 2 buffers (Buffers A and B) being managed by a LRU(Least Recently Used) algorithm, blocks 3 and 4 would be maintained inbuffers A and B, respectively. In other words, blocks 3 and 4 would bemaintained in memory 116. The last data row accessed was in block 4. Ifthe next data row to be accessed is in block 3, a data block changewould occur but not be counted as a block change because block 3 isstill in memory (in Buffer A, for example). However, if the next datarow to be accessed is in block 2, a data block change would occur and becounted since block 2 is not in a buffer (in memory) and a physical IOwould be needed to retrieve block 2 from DASD 120. In a LRU managedbuffer pool, the access of block 2 would load block 2 into the oldestbuffer (i.e. Least Recently Used). In some implementations, the blockchange count may be significantly lower for a buffered sequentialaccess. As such, when a number of buffers are available for a task, adata block change is not counted if a new block number that is beingaccessed would have been in a buffer associated with the task.

As would be appreciated, a particular buffer may store different numbersof data blocks. Furthermore, LRU managed buffer pools are described forillustrative purposes and not limitation. Other types of buffer pools(memory) may be used.

FIG. 3A illustrates an exemplary chart depicting buffered sequentialaccess efficiency for the database table depicted in FIG. 2B with twobuffers. In some implementations, the buffers may be managed by a LRU(least recently used) algorithm. As illustrated in FIG. 3A, even thoughthere still are 12 logical data block changes, database managementserver 112 accesses the data blocks only 8 times (depicted as bufferchanges in FIG. 3A). In other words, instead of 12 data block changes,there are eight data block changes with two buffers because one or moredata blocks do not have to be retrieved from DASD 120 every time thereis a data block change. As such, based on equation (1) above, thedatabase table of FIG. 3A with two buffers is determined to have a 50%buffered sequential access efficiency because (5−1)/8=50%, which is animprovement over the sequential access efficiency of 33%.

FIG. 3B illustrates an exemplary chart depicting buffered sequentialaccess efficiency for the database table depicted in FIG. 2B with fourbuffers. In some implementations, the buffers may be managed by a LRU(least recently used) algorithm. As illustrated in FIG. 3B, even thoughthere still are 12 logical data block changes, database managementserver 112 accesses the data blocks only 4 times (depicted as bufferchanges in FIG. 3B). In other words, instead of 12 data block changes,there are four data block changes with four buffers. As such, based onequation (1) above, the database table of FIG. 3B with four buffers isdetermined to have a 100% buffered sequential access efficiency because(5−1)/4=100%.

In some implementations, database management server 112 may generate oneor more reports. In some implementations, database management server 112may generate the report(s) in response to the request. A report, amongother things, may include the determined sequential access efficiencyfor the database table, and the determined buffered sequential accessefficiency for the database table utilizing one or more numbers ofbuffers (for example, buffered sequential access efficiency with 2buffers, 4 buffers, 8 buffers, and so on).

FIG. 4 depicts an exemplary report generated by database managementserver 112, according to various aspects of the invention. FIG. 4 andother figures illustrating an example of a report is for illustrativepurposes only and should not be viewed as limiting. The report mayinclude various formats and configurations while including or excludingsome header items and values illustrated and adding other header itemsand values not otherwise illustrated in the figure as would beappreciated.

In some implementations, the report may have three sections 402, 404,and 406. Section 402 may describe the report header that providesinformation about the database table being processed. “REO” may indicatethe name of the database table being processed. “REOK1” may indicate thename of the native key sequence for the database table. “GROUP” mayindicate a particular reference group being processed. In someimplementations, a reference group may include a group of rows. “ROWSREAD” may indicate the number of rows in the particular reference group.“BLOCKS WITH DATA” may indicate a number of data blocks that have atleast one data row from the particular reference group. “MAX ROWS” mayindicate a maximum number of rows found on any data block in theparticular reference group. “MIN ROWS” may indicate a minimum number ofrows found on any data block in the particular reference group. “AVERAGEROWS” may indicate an average number of rows per data block. “BLOCKCHANGES” may indicate an actual number of block changes that occurredwhen processing the data rows in the particular reference group insequential order (i.e., according to native key sequence”). “MRB(maximum rows per block) efficiency” may indicate the sequential accessefficiency for the particular reference group. “MRB (Maximum row perblock) efficiency rates with buffers” may indicate the bufferedsequential access efficiency for the particular reference group. “PBC”may indicate a block count for a particular reference group. In someimplementations, PBC may indicate a data block change number that wouldgive 100% sequential access efficiency. In some implementations, as thedata rows in the reference groups are processed, the actual number ofdata block changes that occur is compared against the PBC to determinethe sequential access efficiency.

In some implementations, section 404 may provide detailed informationregarding each reference group associated with the database table. Asillustrated in FIG. 4, the total number of rows (indicated as 31,960 insection 406) in the database table is divided into 9 reference groups.Reference groups 1-8 each have 3,600 rows per group and reference group9 has 3,160 rows.

In some implementations, a reference group may be defined as a groupingof rows where the rows are included in the reference group according totheir native sequence key value. In these implementations, the referencegroup is not a grouping by physical location but rather a grouping bylogical order according to the native sequence key. Referring to FIG. 4,for example, reference group 1 may include the first 3,600 rows in thedatabase table according to native key value (ascending). Referencegroup 2 may have the next 3,600 rows according to native sequence key,and so on. Since the reference group is a logical grouping, the datarows in the groups may be spread across many physical data blocks. For adata block to be part of the reference group it will have at least 1 rowfrom the reference group on the data block. In some implementations, agiven physical data block may contain rows from many different referencegroups.

In some implementations, the sequential efficiency may be determined foreach reference group processed. This may be relevant in databaseimplementations where reorganization processes can be focused on aspecific portion of the database table. In these implementations, havingthe information on each reference group may indicate that only part ofthe table should be reorganized. In some implementations, the sequentialefficiency rating may be produced for the entire table (without respectto reference groups).

Reference group 1, for example, has 3,600 rows and 365 data blocks withat least one data row in them. The maximum number of rows found on anydata block in reference group 1 is 26. The minimum number of rows foundon any data block in reference group 1 is 1. The average number of rowsper data block in reference group 1 is 10. The number of block changesthat occurred when processing the data rows in reference group 1 insequential order (i.e., according to native key sequence) is 720. Insome implementations, the number 720 represents the actual number ofdata block changes that occurred when the data rows are processed.

In some implementations, the actual number of data block changes may becompared against PBC (perfect block count) to determine the sequentialaccess efficiency. In some implementations, database management server112 may determine PBC based on the following equation:N _(R) /N _(Max))−1  (2),Where N_(R) represents a number of rows per reference group and N_(Max)represents a maximum number of rows that will fit on a data block.

In some implementations, database management server 112 maydetermine/calculate the maximum number of rows that will fit on a datablock. For the reference groups of FIG. 4, the maximum number of rowsthat will fit on a data block (MRB) may be determined as 36, forexample. In some implementations the maximum rows per block for a fixedlength data row (not compressed) may be calculated by determining thenumber of data rows that could fit into the data block. In someimplementations, this calculation may be based on the followingequation:(MRB=ABS/RL)  (3),where ABS represents the size of the data block minus any bytes used forblock management and RL represents the stored length of the data rowincluding any bytes that the database management system adds onto therow for management purposes. The calculated MRB value may be rounded toa whole number. Thus, for reference group 1, for example, the number ofdata blocks (if filled to maximum number of rows which is MRB=36) thatwould hold 3,600 rows would be 3,600/36=100. In some implementations,the maximum rows per block for a variable length data row (usuallycompressed) may be determined by physically scanning a set of datablocks and determining the number of data rows that are actually on thedata block. The block with the highest data row content may be used asthe value for MRB.

In some implementations, PBC is determined to be RGR/MRB. Where RGR isthe number of rows in the reference group, MRB is the maximum rows perblock. Referring to FIG. 4, for reference groups 1-8 PBC=3600/36=100(depicted as PBC 100 in section 402). Referring to FIG. 4, referencegroup 9 encompasses the remaining data rows at the high end of the indexand therefore may not be a full size reference group. For this lastreference group the PBC is calculated as PBC=3150/36=88. In theseimplementations, PBC may indicate a data block change number that wouldgive 100% sequential access efficiency. This means that assuming thatthe data rows in a reference group 1-8 are arranged according to nativekey sequence, to read/process the 3,600 data rows on 100 data blocks ineach reference group, 100 block changes would be required. This meansthat assuming that the data rows in a reference group 9 are arrangedaccording to native key sequence, to read/process the 3,150 data rows on88 data blocks in each reference group, 88 block changes would berequired.

In some implementations, the sequential access efficiency (MRBefficiency) for each reference group may be determined. In someimplementations, database management server 112 may determine thesequential access efficiency based on the following equation:PBC_(R) /N _(BC)  (4),where PBC_(R) represents PBC per reference group and N_(BC) representsan actual number of block changes per reference group.

Thus, for reference group 1, for example, the sequential accessefficiency may be determined as 100/720=14%

In some implementations, database management server 112 may determinethe buffered sequential access efficiency (MRB efficiency with buffers)for each reference group. For reference group 1, for example, FIG. 4depicts that the buffered sequential access efficiency with 128 buffersis 17%, with 256 buffers is 19. In FIG. 4, the buffered sequentialaccess efficiency values are only displayed if the determined value withbuffers is higher that a previous entry for the reference group. It willbe appreciated, however, that the buffered sequential access efficiencymay be determined and displayed for all the other sets of buffers (2, 4,8, 12, 16, 20, 24, 28, 32, 64, and 96) without departing from the spiritof the invention.

While the above paragraphs describe values and computations forreference group 1, similar computations may be performed for referencegroups 2-9 and displayed in section 404, as depicted in FIG. 4.

In some implementations, section 406 may provide reference groupinformation for the complete database table. For example, the databasetable is treated as a reference group that has 31,950 rows and 888 datablocks with at least one data row in them. In these implementations,this final reference group is not a summarization of the results of theprevious reference groups. It is a separate analysis of the table as asingle reference group where every row in the table is part of thereference group. The maximum number of rows found on any data block inthe database table is 36. The minimum number of rows found on any datablock in the database table is 18. The average number of rows per datablock in the database table is 36. The actual number of block changesthat occurred when processing the data rows in the database table insequential order (i.e., according to native key sequence”) is 6,931.

In some implementations, the sequential access efficiency for thedatabase table may be determined. In some implementations, databasemanagement server 112 may determine the sequential access efficiency forthe database table based on the following equation:PBC_(T) /N _(T)  (5),Where PBC_(T) represents PBC for the database table and N_(T) representsactual number of block changes for the database table.

In some implementations, PBC_(T) may be determined based on thefollowing equation:(N _(r) /R _(max))−1  (6),Where Nr represents number of rows per database table and Rmaxrepresents actual maximum rows per block.

Thus, the sequential access efficiency for the database table may bedetermined as (31,950/36)/6,931=13%.

In some implementations, database management server 112 may determine,while processing the entire table, the actual maximum number of rows perblock. For calculations where the full database table is being reviewedRmax as shown above is preferable to the calculated MRB. In this examplecalculated MRB and actual MRB is the same (36).

In some implementations, database management server 112 may determinethe buffered sequential access efficiency for the database table. Forexample, FIG. 4 depicts that the buffered sequential access efficiencyfor the database table with 128 buffers is 14%, with 256 buffers is 16%.In FIG. 4, the buffered sequential access efficiency values are onlydisplayed if the determined value with buffers is higher that a previousentry for the database table. It will be appreciated, however, that thebuffered sequential access efficiency may be determined and displayedfor all the other sets of buffers (2, 4, 8, 12, 16, 20, 24, 28, 32, 48,64, and 96) without departing from the spirit of the invention.

In some implementations, database management server 112 may determine aadjusted sequential access efficiency (AMRB) for the database table(depicted in the second line in section 406). In some implementations,the adjusted sequential access efficiency may be determined based on theactual number of blocks with data. The adjusted sequential accessefficiency may be determined by the following equation:PBC_(A) /N _(BC)  (7),Where PBC_(A) represents an adjusted PBC for the database table andN_(BC) represents the actual number of block changes for the databasetable.

In some implementations, PBC_(A) may be determined based on thefollowing equation:Blocks with data−1  (8).

Thus, the adjusted sequential access efficiency for the database tablemay be determined as (888)/6,931=13%.

In some implementations, the adjusted sequential access efficiencydiffers from the MRB access efficiency in that the adjusted sequentialefficiency does not penalize the efficiency rating for data blocks thatare not completely full (MRB). In other words, at the database tablelevel MRB sequential efficiency is based on the all data rows being inorder (by native sequence key) and all data blocks having the maximumnumber of rows per block. The adjusted sequential efficiency is based onthe data row order by native key. Referring to FIG. 4, section 406, inthese implementations, the MRB efficiency (first line) and the adjustedsequential efficiency (second line) are the same because the data blocksare full (of rows). In the example FIG. 4A, the same information isdisplayed and calculated for the table in section 402 and 404. However,in this figure the REO table has had significant data row additions anddeletions of data rows which has spread the data rows across more datablocks. This is evidenced by the fact that the average rows per block insection 406 has dropped from 36 (in FIG. 4) to 18 in (FIG. 4A). In FIG.4A section 406 we now see that the MRB Efficiency rating may bedetermined as (32,437/36)/4,917=18% while the adjusted MRB Efficiencyrating may be determined as (1796)/4,917=36%.

In some implementations, database management server 112 or a databaseadministrator (or other user) may determine whether a databasereorganization process for one or more reference groups and/or thecomplete database table should be performed. In some implementations,the determination may be based on the sequential access efficiencyand/or the buffered sequential access efficiency values. In someimplementations, a determination that a reorganization should beperformed is made when the sequential access efficiency and/or thebuffered sequential access efficiency reaches below a particularthreshold (for example, less than 50%). In some implementations, thedetermination may be based on the information included in the generatedreport. In some implementations, based on the report of FIG. 4A forexample, the low sequential access efficiency for the reference group(s)and/or table combined with the low buffered sequential access efficiencyfor the reference group(s) and/or table indicates that a datareorganization process should be performed.

In some implementations, the sequential access efficiency and/orbuffered sequential access efficiency values provide an efficient andaccurate method for determining whether a database reorganizationprocess should be performed. This may reduce the number of databaseoutages or other disruptions to perform unnecessary reorganizations.Reducing the number of resources consumed by unnecessary reorganizationsmay improve the overall 24×7 database availability.

In some implementations, in response to a determination that a databasereorganization process should be performed, database management server112 may trigger the database reorganization process for the referencegroup(s), the database table, and/or other segment or grouping of thedatabase. In some implementations, the database reorganization processmay extract the data rows from the reference group(s), table, and/orother segment, re-order the data rows according to the native keysequence, and replace the ordered data rows into the reference group(s),table, and/or other segment.

FIG. 5 depicts an exemplary report generated by database managementserver 112 after the database reorganization process on the referencegroup(s) and/or database table of FIG. 4A has been performed, accordingto various aspects of the invention. As illustrated in FIG. 5, thesequential access efficiency and/or the buffered sequential accessefficiency for the reference group(s) and the database table is 100%because the data row sequence follows the native key sequence. In someimplementations, the report of FIG. 5 may depict the sequential accessefficiency and the buffered sequential access efficiency after anoffline database reorganization process is performed. In implementationswhere an online database reorganization is utilized, the results may notreach 100% efficiency. This is due to limitations on how thoroughly thedata can be reorganized while it is still being actively updated byusers.

In some implementations, the reports of FIGS. 4, 4A and 5 may begenerated while the database is online (i.e., open for processing).

In some implementations, a report generated after an online databasereorganization process is performed may indicate an amount ofimprovement the online reorganization process provided based on thesequential access efficiency and/or buffered sequential accessefficiency values. Also, these values may further may be used todetermine whether another online database reorganization should beperformed.

In some implementations, database tables and/or data rows in thedatabase tables may be compressed by database management server 112before storing them on DASD 120 in the form of, for example, compresseddata rows in the data blocks. Thus, the various operations describedabove may be performed by database management server 112 on thecompressed tables/rows. Because the amount of compression found in eachdata row will vary, the efficiency rating process may use thealternative scanning method (as described above) to determine the MRBvalue for the reference group analysis (FIG. 4 section 404). The actualMRB value is known for the full table (FIG. 4 Section 406) calculations.While compressed rows may add a certain amount of variance to thereference group calculations, the efficiency estimates will be withinreason and the full table MRB and AMRB will reflect the table's actualefficiency.

FIG. 6 is a flowchart 600 depicting example operations performed by adatabase management server 112 to determine sequential and/or bufferedsequential access efficiencies, according to various aspects of theinvention. The various processing operations depicted in FIG. 6 aredescribed in greater detail herein. The described operations for a flowdiagram may be accomplished using some or all of the system componentsdescribed in detail above and, in some implementations of the invention,various operations may be performed in different sequences. In someimplementations, additional operations may be performed along with someor all of the operations shown in FIG. 6. In yet other implementations,one or more operations may be performed simultaneously. In yet otherimplementations, one or more operations may not be performed.Accordingly, the operations described are exemplary in nature and, assuch, should not be viewed as limiting.

In operation 602, process 600 may determine a sequential access and/or abuffered sequential access for a plurality of rows of a database tables.In some implementations, a sequential access occurs when at least aportion of the database table is accessed. In some implementations,determining a sequential access may include accessing the plurality ofrows of the database table sequentially according to the native keysequence. In some implementations, determining a sequential access mayinclude using a least recently used (LRU) algorithm to determine how thedata blocks storing the plurality of rows have been accessed.

In some implementations, process 600 may determine a buffered sequentialaccess of a plurality of rows of a database table based on a number ofbuffers used to buffer the buffered sequential access (for example, 2buffers, 4 buffers, 8 buffers, and so on). In some implementations,determining a buffered sequential access may include accessing theplurality of rows of the database table sequentially according to thenative key sequence utilizing a set number of buffers.

In operation 604, process 600 may determine a number of data blockchanges that occur during the sequential access of the plurality of rowsin the database table. In some implementations, process 600 maydetermine a number of data block changed that occur during the bufferedsequential access of the plurality of rows in the database table.

In operation 606, process 600 may determine a sequential accessefficiency and/or a buffered sequential access efficiency for thedatabase table. In some implementations, determining a sequential accessefficiency for the database table may include determining the sequentialaccess efficiency based on the determined number of data block changesthat occur during the sequential access. In some implementations,determining a buffered sequential access efficiency for the databasetable may include determining a buffered sequential access efficiencybased on the determined number of data block changes that occur duringthe buffered sequential access and the number of data buffers utilizedto buffer the first buffered sequential access.

In operation 608, process 600 may generate a report. In someimplementations, the generated report may include the determinedsequential access efficiency and/or the determined buffered sequentialaccess efficiency based on the number of buffers (for example, 2buffers, 4 buffers, 8 buffers, and so on).

In some implementations, one or more operations of process 600 may beperformed in response to a user request (or other request) to determinea sequential access efficiency and/or buffered sequential accessefficiency for a database table, or in response to a user request (orother request) to generate a report describing the sequential accessefficiency and/or buffered sequential access efficiency for a databasetable. In some implementations, the request(s) may include one or moreparameters identifying the database table for which the sequentialaccess efficiency is to be determined, a native key sequence for thedatabase table, reference group size, and/or other parameters.

In some implementations, one or more operations of process 600 may beperformed while the database is online. In some implementations, one ormore operations of process 600 may be performed while the database isoffline.

Implementations of the invention may be made in hardware, firmware,software, or various combinations thereof. Implementations of theinvention may also be implemented as computer-readable instructionsstored on a tangible computer-readable storage medium which may be readand executed by one or more processors. A tangible computer-readablestorage medium may include any tangible, non-transitory, mechanism forstoring or transmitting information in a form readable by a machine(e.g., a computing device). For example, a tangible computer-readablestorage medium may include read only memory, random access memory,magnetic disk storage media, optical storage media, flash memorydevices, and/or other tangible storage media. Intangiblemachine-readable transmission media may include intangible forms ofpropagated signals, such as carrier waves, infrared signals, digitalsignals, and/or other intangible transmission media. Further, firmware,software, routines, or instructions may be described in the abovedisclosure in terms of specific exemplary aspects and implementations ofthe invention and performing certain actions. However, it will beapparent that such descriptions are merely for convenience, and thatsuch actions may in fact result from computing devices, processors,controllers, or other devices executing firmware, software, routines orinstructions.

Implementations of the invention may be described as including aparticular feature, structure, or characteristic, but every aspect orimplementation may not necessarily include the particular feature,structure, or characteristic. Further, when a particular feature,structure, or characteristic is described in connection with an aspector implementation, it will be understood that such feature, structure,or characteristic may be included in connection with otherimplementations, whether or not explicitly described. Thus, variouschanges and modifications may be made to the provided descriptionwithout departing from the scope or spirit of the invention.

Other embodiments, uses and advantages of the invention will be apparentto those skilled in the art from consideration of the specification andpractice of the invention disclosed herein. The specification anddrawings should be considered exemplary only, and the scope of theinvention is accordingly intended to be determined solely by theappended claims.

What is claimed is:
 1. A computer-implemented method of determiningsequential access efficiency for a database table, the method executedby a processor to perform a plurality of operations, the operationscomprising: determining a sequential access of a plurality of rows of adatabase table, wherein the plurality of rows are stored using aplurality of data blocks, and wherein the sequential access occurs whena portion of the database table is accessed; determining a number ofdata block changes that occur during the sequential access of theplurality of rows in the database table, wherein a data block changeoccurs when a current row is stored in a first data block and a next rowis stored in a second data block, different from the first data block,such that accessing the next row after accessing the current row resultsin the data block change; and calculating a sequential access efficiencybased on the determined number of data block changes, whereincalculating the sequential access efficiency is performed using thefollowing equation:(N _(B)−1)/N _(C) wherein N_(B) is the determined number of data blocksand N_(c) the determined number of data block changes.
 2. Thecomputer-implemented method of claim 1, wherein determining thesequential access comprises using a least recently used (LRU) algorithmto determine how the data blocks have been accessed.
 3. Thecomputer-implemented method of claim 1, wherein determining thesequential access comprises accessing the plurality of rows of thedatabase table sequentially according to a native key sequence.
 4. Thecomputer-implemented method of claim 1, wherein the operations furthercomprise: determining a number of data blocks that contain data, whereincalculating the sequential access efficiency further comprises:calculating the sequential access efficiency based on the determinednumber of data block changes and the determined number of data blocks.5. The computer-implemented method of claim 1, wherein the operationsfurther comprise: determining a block count, wherein the block count isbased on a maximum number of rows per data block and a number of theplurality of rows; and wherein calculating the sequential accessefficiency further comprises calculating the sequential accessefficiency based on the determined number of data block changes and thedetermined block count.
 6. The computer-implemented method of claim 1,wherein the operations further comprise: determining a first bufferedsequential access of the plurality of rows of the database table basedon a first number of buffers used to buffer the first bufferedsequential access; determining a first number of first data blockchanges that occur during the first buffered sequential access; andcalculating a first buffered sequential access efficiency value based onthe determined first number of data block changes and the first numberof data buffers utilized to buffer the first buffered sequential access.7. The computer-implemented method of claim 6, wherein the operationsfurther comprise: determining a second buffered sequential access of theplurality of rows of the database table based on a second number ofbuffers used to buffer the second buffered sequential access;determining a second number of first data block changes that occurduring the second buffered sequential access; and calculating a secondbuffered sequential access efficiency value based on the determinedsecond number of data block changes and the second number of databuffers utilized to buffer the first buffered sequential access.
 8. Thecomputer-implemented method of claim 7, wherein the operations furthercomprise: generating a report that comprises the calculated sequentialaccess efficiency, the calculated first buffered sequential accessefficiency value, and the calculated second buffered sequential accessefficiency value.
 9. The computer-implemented method of claim 1, whereindetermining the sequential access comprises determining the sequentialaccess while the database is online.
 10. The computer-implemented methodof claim 1, wherein determining the sequential access comprisesdetermining the sequential access while the database is offline.
 11. Acomputer-implemented system of determining sequential access efficiencyfora database table, the system comprising: a processor to: determine asequential access of a plurality of rows of a database table, whereinthe plurality of rows are stored using a plurality of data blocks,wherein the sequential access occurs when a portion of the databasetable is accessed; determine a number of data block changes that occurduring the sequential access of the plurality of rows in the databasetable, wherein a data block change occurs when a current row is storedin a first data block and a next row is stored in a second data block,different from the first data block, such that accessing the next rowafter accessing the current row results in the data block change; andcalculate a sequential access efficiency based on the determined numberof data block changes, wherein calculating the sequential accessefficiency is performed using the following equation:(N _(B)−1)/N _(C) wherein N_(B) is the determined number of data blocksand N_(c) the determined number of data block changes.
 12. Thecomputer-implemented system of claim 11, wherein the processor todetermine the sequential access is further to use a least recently used(LRU) algorithm to determine how the data blocks have been accessed. 13.The computer-implemented system of claim 11, wherein the processor todetermine the sequential access is further to access the plurality ofrows of the database table sequentially according to a native keysequence.
 14. The computer-implemented system of claim 11, wherein theprocessor is further to: determine a number of data blocks that containdata, wherein the processor to determine the sequential accessefficiency is further to calculate the sequential access efficiencybased on the determined number of data block changes and the determinednumber of data blocks.
 15. The computer-implemented system of claim 11,wherein the processor is further to: determine a block count, whereinthe block count is based on a maximum number of rows per data block anda number of the plurality of rows, wherein the processor to determinethe sequential access efficiency is further to calculate the sequentialaccess efficiency based on the determined number of data block changesand the determined block count.
 16. The computer-implemented system ofclaim 11, wherein the processor is further to: determine a firstbuffered sequential access of the plurality of rows of the databasetable based on a first number of buffers used to buffer the firstbuffered sequential access; determine a first number of first data blockchanges that occur during the first buffered sequential access; andcalculate a first buffered sequential access efficiency value based onthe determined first number of data block changes and the first numberof data buffers utilized to buffer the first buffered sequential access.17. The computer-implemented system of claim 16, wherein the processoris further to: determine a second buffered sequential access of theplurality of rows of the database table based on a second number ofbuffers used to buffer the second buffered sequential access; determinea second number of first data block changes that occur during the secondbuffered sequential access; and calculate a second buffered sequentialaccess efficiency value based on the determined second number of datablock changes and the second number of data buffers utilized to bufferthe first buffered sequential access.
 18. The computer-implementedsystem of claim 17, wherein the processor is further to: generate areport that comprises the calculated sequential access efficiency, thecalculated first buffered sequential access efficiency, and thecalculated second buffered sequential access efficiency value.
 19. Anon-transitory, tangible computer-readable storage medium havingcomputer-readable instructions thereon which when executed by aprocessor cause the processor to: determine a sequential access of aplurality of rows of a database table, wherein the plurality of rows arestored using a plurality of data blocks, and wherein the sequentialaccess occurs when a portion of the database table is accessed;determine a number of data block changes that occur during thesequential access of the plurality of rows in the database table,wherein a data block change occurs when a current row is stored in afirst data block and a next row is stored in a second data block,different from the first data block, such that accessing the next rowafter accessing the current row results in the data block change; andcalculate a sequential access efficiency based on the determined numberof data block changes, wherein calculating the sequential accessefficiency is performed using the following equation:(N _(B)−1)/N _(C) wherein N_(B) is the determined number of data blocksand N_(c) the determined number of data block changes.
 20. Thenon-transitory, tangible computer-readable storage medium of claim 19,wherein the computer-readable instructions further cause the processorto: determine a first buffered sequential access of the plurality ofrows of the database table based on a first number of buffers used tobuffer the first buffered sequential access; determine a first number offirst data block changes that occur during the first buffered sequentialaccess; and calculate a first buffered sequential access efficiencyvalue based on the determined first number of data block changes and thefirst number of data buffers utilized to buffer the first bufferedsequential access.
 21. The non-transitory, tangible computer-readablestorage medium of claim 20, wherein computer-readable instructionsfurther cause the processor to: determine a second buffered sequentialaccess of the plurality of rows of the database table based on a secondnumber of buffers used to buffer the second buffered sequential access;determine a second number of first data block changes that occur duringthe second buffered sequential access; and calculate a second bufferedsequential access efficiency value based on the determined second numberof data block changes and the second number of data buffers utilized tobuffer the first buffered sequential access.
 22. The non-transitory,tangible computer-readable storage medium of claim 21, wherein thecomputer-readable instructions further cause the processor to: generatea report that comprises the calculated sequential access efficiency, thecalculated first buffered sequential access efficiency value, and thecalculated second buffered sequential access efficiency value.